package com.example.liyuehui.paging.http;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Path;

public class HttpMethod {

	private static Retrofit retrofit;
	private static HttpService httpService;

	public static HttpService getService() {
		if (retrofit == null) {
			retrofit = new Retrofit.Builder().baseUrl("https://dev-restful.locweb.cc/")
					.addConverterFactory(GsonConverterFactory.create()).build();
		}
		if (httpService == null) {
			httpService = retrofit.create(HttpService.class);
		}
		return httpService;
	}

	public interface HttpService {

		@GET("/mall/goods/list/1/{page}/{limit}?sortBy=onsale_time&sort=des")
		@Headers("X-SELLER-LONG: 599fe94303b1c1bf4b37436f")
		public Call<Object> getList(@Path("page") int page, @Path("limit") int limit);
	}
}
